package com.ithema.controller;

import com.ithema.domain.Order;
import com.ithema.domain.Product;
import com.ithema.service.OrderService;
import com.ithema.service.ProductService;
import com.ithema.service.impl.OrderServiceImpl3;
import com.ithema.util.JsonConverter;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.cloud.client.ServiceInstance;
import org.springframework.cloud.client.discovery.DiscoveryClient;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import org.springframework.web.client.RestTemplate;

import java.util.List;
import java.util.Random;

/**
 * @Description
 * @Author wangyu
 * @Date 2021/10/31
 */
@Slf4j
@RestController
@RequestMapping("/v3")
public class OrderController3 implements JsonConverter {

    @Autowired
    private OrderService orderService;

    @Autowired
    private RestTemplate restTemplate;

    @Autowired
    private DiscoveryClient discoveryClient;

    @Autowired
    private ProductService productService;

    @Autowired
    private OrderServiceImpl3 orderServiceImpl3;

    @RequestMapping("/order/message1")
    public String message1(){
        log.info("message1...");
//        orderServiceImpl3.message("message1");
//        return "message1";
        return orderServiceImpl3.message("message1");
    }

    @RequestMapping("/order/message2")
    public String message2(){
        log.info("message2...");
        orderServiceImpl3.message("message2");
        return "message2";
    }

    @RequestMapping("/order/message3")
    public String message3(){
        log.info("message3...");
        return "message3";
    }


}
